<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <script>
        window.onload=function(){
            //全局声明组件
            Vue.component('my-div',{
                data(){
                    return{
                        num:0
                    }
                },
                methods:{
                    handler(){
                        this.num++;
                    }
                },
                template:`
                    <div>
                        <h1>header-{{num}}</h1>
                        <p>hello-contains</p>
                        <button @click='handler'>click</button>
                    </div>
                `
            });
            new Vue({
                el:'#app',
                data:{},
                methods:{}
            });
        }
    </script>
</head>
<body>
    <div id="app">
        <my-div></my-div>
        <my-div></my-div>
        <my-div></my-div>
    </div>
</body>
</html>